Skip to main content

[ALPHA] Call Fabric

Call Fabric is the embodiment of SignalWire's vision for Programmable Unified Communications. It is effectively a new paradigm in communications, designed to streamline usage and development across all communication types.

Check out our What is Call Fabric? guide to learn more, and make sure to read our CEO's blog to see how it the next evolution from FreeSWITCH!

warning

Call Fabric additions to SignalWire's Browser SDK are in Alpha state, and should not be used in production.

Installation

Install locally

npm install @signalwire/js@dev

Or include it in your client using our CDN

<script src="https://cdn.signalwire.com/@signalwire/js@dev"></script>

Concepts

Resources

Resources are the primary entities for communication within SignalWire. Resources include: Subscribers SWML Scripts, SignalWire AI Agents, Video-Rooms, SIP Endpoints, etc.

Subscribers

Subscribers represent the end-users within SignalWire. They are the endpoints of communication, capable of receiving or initiating calls, messages, and other forms of interaction.

SignalWire allows subscribers to switch from one type of communication to another. For example, switching from a phone call into a video-room to a web-based video call.

You can create Subscribers and Resources in the Resource section of your SignalWire Dashboard, or with a HTTP POST request:

curl --location --request POST 'https://spacename.signalwire.com/api/fabric/subscribers' \
--user "project_id:api key" \
--header 'Content-Type: application/json' \
--data-raw '{
"email": "[the subscriber email]",
"password": "[the subscriber password]"
}'

Addresses

Each resource and subscriber is uniquely identified by an addresses which can be called, sent messages to, or interacted with in some other way.

The address is composed of two parts: "/context/name"

  • Context: A identifier that indicates in which context the resource is located.
  • Name: The name is the unique identifier for the resource.

For example, the address for a Subscribers resource named Alice in the public context would be /public/Alice.

Authentication

OAuth2 based authentication for Subscribers

When you create a Subscriber, you assign them a username (email) and a password. These credentials can be used authenticate the subscriber using the standard OAuth2 flow with PKCE. For OAuth2, you can use tools like odic-client-ts or react-native-app-auth.

You can also use this node.js script from SignalWire Community to get a token for a subscriber.

import { UserManager, WebStorageStateStore } from "oidc-client-ts";

const config = {
authority: "x", // dummy authority
metadata: {
issuer: "https://id.fabric.signalwire.com/",
authorization_endpoint: "https://id.fabric.signalwire.com/login/oauth/authorize",
token_endpoint: "https://id.fabric.signalwire.com/oauth/token",
},
client_id: "<Your_Fabric_Client_id>",
redirect_uri: "https://redirect_uri",
response_type: "code",
userStore: new WebStorageStateStore({ store: window.localStorage }),
};

const userManager = new UserManager(config);

await userManager.signinRedirect();